package com.fzh.study.sharedingjdbcdemo.controller;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fzh.study.sharedingjdbcdemo.pojo.User;
import com.fzh.study.sharedingjdbcdemo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Random;

@RestController
@RequestMapping("/")
public class TestController {

    @Autowired
    UserService userService;

    @GetMapping("/save")
    public String save(){

        return userService.addUser();
    }

    @GetMapping("/findAll")
    public String findAll(){

        return userService.getUserList();
    }

    @GetMapping("/delete/{user_id}")
    public String delete(@PathVariable("user_id") Long user_id){
        return userService.delUser(user_id);
    }

}
